package com.ruoyi.common.annotation;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        List<Employee> employees = new ArrayList<>();
        Employee xiaoMing=new Employee("小明",2500);
        Employee xiaoJun=new Employee("小军",8000);
        Employee xiaoHong=new Employee("小红",100000);
        employees.add(xiaoMing);
        employees.add(xiaoJun);
        employees.add(xiaoHong);


        for(Employee item:employees){
            BigDecimal bigDecimal=new BigDecimal(calculate(item.getSalary()));
            double shui=calculate(item.getSalary());
            System.out.println(item.getName()+"应该缴纳的个人所得税是:"+Double.valueOf(String.format("%.1f",shui)));
        }

        //write your code here......
    }
    public static double calculate(double salary){
        double kouchushu=salary-3500;
        if ((kouchushu<=0)){
            return 0;
        } else if (kouchushu<=1500) {
            return kouchushu*0.03-0;
        } else if (kouchushu<=4500) {
            return kouchushu*0.10-105;
        } else if (kouchushu<=9000) {
            return kouchushu*0.20-555;
        } else if (kouchushu<=35000) {
            return kouchushu*0.25-1005;
        } else if (kouchushu<=55000) {
            return kouchushu*0.30-2755;
        } else if (kouchushu<=80000) {
            return kouchushu*0.35-5505;
        } else if (kouchushu>80000) {
            return kouchushu*0.45-13505;
        }

        return 0;
    }
}
class Employee{
    private String name;
    private double salary;
    public Employee(String name, double salary) {
        this.name = name;
        this.salary = salary;
    }
    public String getName() {
        return name;
    }

    public double getSalary() {
        return salary;
    }


}